<f:layout name="Default"/>
<f:section name="main">
    <f:if condition="{access}">
        <div class="text-center"><button type="button" class="btn c-btn-square c-theme-btn c-btn-uppercase c-btn-bold" data-toggle="modal" data-target="#modal-pay-{contentObject.uid}">{settings.buttontext}</button></div>
        <div id="modal-pay-{contentObject.uid}" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <f:form actionUri="" name="newPay" object="{newPay}">
                        <fieldset>
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title">{settings.buttontext}</h4>
                            </div>
                            <div class="modal-body">
                                <f:render partial="Pay/FormFields" />
                            </div>
                            <div class="modal-footer">
                                <input type="hidden" name="tx_payment_pay[action]" value="create" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                <f:form.submit value="提交" class="btn btn-primary"/>
                            </div>
                        </fieldset>
                    </f:form>
                    <!--<f:render partial="FormErrors" arguments="{object:Donors}"/>-->
                    <f:form.validationResults for="{object}">
                        <f:if condition="{validationResults.flattenedErrors}">
                            <div class="alert alert-danger">填写错误!</div>
                            <script>
                                (function($){
                                    $(function(){
                                        $("#modal-pay-<f:format.raw>{contentObject.uid}</f:format.raw>").modal('show');
                                    });
                                })(jQuery)
                            </script>
                        </f:if>
                    </f:form.validationResults>
                </div>
            </div>
        </div>
        <f:flashMessages renderMode="div" />
    </f:if>
</f:section>